/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package irsystem;

import irsystem.collection.CISI;
import irsystem.scenario.Experiment;
import irsystem.scenario.QueryScenario;
import irsystem.scenario.ScenarioOption;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author User
 */
public class Data {
    static QueryScenario qs;
    static Experiment ex;
    static CISI cisi;
    static ScenarioOption option;

    public static CISI getCisi() {
        if(cisi==null)
        {
            try {
                cisi=CISI.readFromFiles("cisi.all", "qrels.text", "query.text", "stopword.txt");
            } catch (FileNotFoundException ex) {
                Logger.getLogger(Data.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(Data.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        return cisi;
    }

    public static Experiment getExperiment() {
        if(ex==null)
        {
            ex=new Experiment(getOption(), getCisi(), null);
        }
        return ex;
    }

    public static QueryScenario getQueryScenario() {
        if(qs==null)
        {
            qs=new QueryScenario(getOption(), getCisi(), null, null);
        }
        return qs;
    }

    public static ScenarioOption getOption() {
        if(option==null)
        {
            option=new ScenarioOption(true, true, ScenarioOption.TF_AUGMENTED, true, true);
        }
        return option;
    }

    public static void setOption(ScenarioOption option) {
        Data.option = option;
    }
}
